<template>
    <div class="container scopClass">
        <h3>物料管理</h3>
        <el-tabs v-model="activeName" type="border-card" style="margin-top:20px;" @tab-click="handleClick">
            <el-tab-pane label="中药材" name="中药材">
                <el-row style="margin:20px 0;">
                    <el-col :span="7">
                        <el-input style="border-radius: 0 5px 5px 0;width:300px;" placeholder="请输入关键词"  v-model.trim="searchName1">
                            <i slot="prefix" class="el-input__icon el-icon-search"></i>
                            <el-button slot="append" @click="handleSearch1">搜索</el-button>
                        </el-input>
                    </el-col>
                    <el-button style="float:right; margin-right: 10px" @click="download">模板下载</el-button>
                    <el-upload
                        class="upload-daoru"
                        ref="upload"
                        :action="action"
                        :on-change="uploadonchange"
                        accept=".xlsx,.xls"
                        :show-file-list='false'
                        :auto-upload="false"
                        >
                        <el-button slot="trigger" size="small">导入模板</el-button>
                    </el-upload>
                    <router-link :to="{path:'/managematerialsManagement/added',query: {type: '中药材',sid:activeName1}}"><el-button type="primary" v-if="added" style="float:right; margin-right: 10px">新建物料</el-button></router-link>
                </el-row>
                <el-table
                    :data="tableData"
                    border
                    ref="multipleTable"
                    header-cell-class-name="table-header"
                >
                    <!-- <el-table-column prop="fromFactoryName" sortable label="厂区标识"></el-table-column> -->
                    <el-table-column prop="breedName" sortable label="名称"></el-table-column>
                    <el-table-column prop="materialType" sortable label="物料类型"></el-table-column>
                    <el-table-column prop="materialCode" sortable label="物料代码"></el-table-column>
                    <el-table-column prop="ypCode" sortable label="药品标识码"></el-table-column>
                    <el-table-column prop="status" sortable label="状态">
                        <template slot-scope="scope">
                            {{scope.row.status == 0?'启用':'禁用'}}
                        </template>
                    </el-table-column>
                    <el-table-column label="操作" width="150" align="center">
                        <template slot-scope="scope">
                            <el-button
                                type="text"
								v-if="edit"
                                @click="handleEdit(scope.$index, scope.row)"
                            >编辑</el-button>
                            <el-button
                                type="text"
                                @click="handleView(scope.$index, scope.row)"
                            >查看</el-button>
                            <el-button
                                v-if="scope.row.status == 0"
                                type="text"
                                @click="isOk(scope.$index, scope.row)"
                            >禁用</el-button>
                            <el-button
                                v-if="scope.row.status == 1"
                                type="text"
                                @click="isNo(scope.$index, scope.row)"
                            >启用</el-button>
                            <!-- <el-button
                                type="text"
                                @click="handleDelete(scope.$index, scope.row)"
                            >删除</el-button> -->
                        </template>
                    </el-table-column>
                </el-table>
                <el-pagination layout="total, prev, pager, next, jumper" :page-size="pagesize1" @current-change="handleCurrentChange1" :total="total1" :current-page.sync="currentPage1" style="margin-top:20px"></el-pagination>
            </el-tab-pane>
            <el-tab-pane label="辅料" name="辅料">
                <el-row style="margin:20px 0;">
                    <el-col :span="7">
                        <el-input style="border-radius: 0 5px 5px 0;width:300px;" placeholder="请输入关键词"  v-model.trim="searchName2">
                            <i slot="prefix" class="el-input__icon el-icon-search"></i>
                            <el-button slot="append" @click="handleSearch2">搜索</el-button>
                        </el-input>
                    </el-col>
                    <el-button style="float:right; margin-right: 10px" @click="download">模板下载</el-button>
                    <el-upload
                        class="upload-daoru"
                        ref="upload"
                        :action="action"
                        :on-change="uploadonchange"
                        accept=".xlsx,.xls"
                        :show-file-list='false'
                        :auto-upload="false"
                        >
                        <el-button slot="trigger" size="small">导入模板</el-button>
                    </el-upload>
                    <router-link :to="{path:'/managematerialsManagement/added',query: {type: '辅料',sid:activeName1}}"><el-button type="primary" v-if="added" style="float:right; margin-right: 10px">新建物料</el-button></router-link>
                </el-row>
                <el-table
                    :data="tableData"
                    border
                    ref="multipleTable"
                    header-cell-class-name="table-header"
                >
                    <!-- <el-table-column prop="fromFactoryName" sortable label="厂区标识"></el-table-column> -->
                    <el-table-column prop="breedName" sortable label="名称"></el-table-column>
                    <el-table-column prop="materialType" sortable label="物料类型"></el-table-column>
                    <el-table-column prop="materialCode" sortable label="物料代码"></el-table-column>
                    <el-table-column prop="ypCode" sortable label="药品标识码"></el-table-column>
                    <el-table-column prop="status" sortable label="状态">
                        <template slot-scope="scope">
                            {{scope.row.status == 0?'启用':'禁用'}}
                        </template>
                    </el-table-column>
                    <el-table-column label="操作" width="150" align="center">
                        <template slot-scope="scope">
                            <el-button
                                type="text"
								v-if="edit"
                                @click="handleEdit(scope.$index, scope.row)"
                            >编辑</el-button>
                            <el-button
                                type="text"
                                @click="handleView(scope.$index, scope.row)"
                            >查看</el-button>
                            <el-button
                                v-if="scope.row.status == 0"
                                type="text"
                                @click="isOk(scope.$index, scope.row)"
                            >禁用</el-button>
                            <el-button
                                v-if="scope.row.status == 1"
                                type="text"
                                @click="isNo(scope.$index, scope.row)"
                            >启用</el-button>
                            <!-- <el-button
                                type="text"
                                @click="handleDelete(scope.$index, scope.row)"
                            >删除</el-button> -->
                        </template>
                    </el-table-column>
                </el-table>
                <el-pagination layout="total, prev, pager, next, jumper" :page-size="pagesize2" @current-change="handleCurrentChange2" :total="total2" :current-page.sync="currentPage2" style="margin-top:20px"></el-pagination>
            </el-tab-pane>
            <el-tab-pane label="提取饮片" name="提取饮片">
                <el-row style="margin:20px 0;">
                    <el-col :span="7">
                        <el-input style="border-radius: 0 5px 5px 0;width:300px;" placeholder="请输入关键词"  v-model.trim="searchName3">
                            <i slot="prefix" class="el-input__icon el-icon-search"></i>
                            <el-button slot="append" @click="handleSearch3">搜索</el-button>
                        </el-input>
                    </el-col>
                    <el-button style="float:right; margin-right: 10px" @click="download">模板下载</el-button>
                    <el-upload
                        class="upload-daoru"
                        ref="upload"
                        :action="action"
                        :on-change="uploadonchange"
                        accept=".xlsx,.xls"
                        :show-file-list='false'
                        :auto-upload="false"
                        >
                        <el-button slot="trigger" size="small">导入模板</el-button>
                    </el-upload>
                    <router-link :to="{path:'/managematerialsManagement/added',query: {type: '提取饮片',sid:activeName1}}"><el-button type="primary" v-if="added" style="float:right; margin-right: 10px">新建物料</el-button></router-link>
                </el-row>
                <el-table
                    :data="tableData"
                    border
                    ref="multipleTable"
                    header-cell-class-name="table-header"
                >
                    <!-- <el-table-column prop="fromFactoryName" sortable label="厂区标识"></el-table-column> -->
                    <el-table-column prop="breedName" sortable label="名称"></el-table-column>
                    <el-table-column prop="materialType" sortable label="物料类型"></el-table-column>
                    <el-table-column prop="materialCode" sortable label="物料代码"></el-table-column>
                    <el-table-column prop="ypCode" sortable label="药品标识码"></el-table-column>
                    <el-table-column prop="status" sortable label="状态">
                        <template slot-scope="scope">
                            {{scope.row.status == 0?'启用':'禁用'}}
                        </template>
                    </el-table-column>
                    <el-table-column label="操作" width="150" align="center">
                        <template slot-scope="scope">
                            <el-button
                                type="text"
								v-if="edit"
                                @click="handleEdit(scope.$index, scope.row)"
                            >编辑</el-button>
                            <el-button
                                type="text"
                                @click="handleView(scope.$index, scope.row)"
                            >查看</el-button>
                            <el-button
                                v-if="scope.row.status == 0"
                                type="text"
                                @click="isOk(scope.$index, scope.row)"
                            >禁用</el-button>
                            <el-button
                                v-if="scope.row.status == 1"
                                type="text"
                                @click="isNo(scope.$index, scope.row)"
                            >启用</el-button>
                            <!-- <el-button
                                type="text"
                                @click="handleDelete(scope.$index, scope.row)"
                            >删除</el-button> -->
                        </template>
                    </el-table-column>
                </el-table>
                <el-pagination layout="total, prev, pager, next, jumper" :page-size="pagesize3" @current-change="handleCurrentChange3" :total="total3" :current-page.sync="currentPage3" style="margin-top:20px"></el-pagination>
            </el-tab-pane>
			<el-tab-pane label="配方颗粒(浸膏粉)" name="配方颗粒(浸膏粉)">
			    <el-row style="margin:20px 0;">
			        <el-col :span="7">
			            <el-input style="border-radius: 0 5px 5px 0;width:300px;" placeholder="请输入关键词"  v-model.trim="searchName5">
			                <i slot="prefix" class="el-input__icon el-icon-search"></i>
			                <el-button slot="append" @click="handleSearch5">搜索</el-button>
			            </el-input>
			        </el-col>
			        <el-button style="float:right; margin-right: 10px" @click="download">模板下载</el-button>
			        <el-upload
			            class="upload-daoru"
			            ref="upload"
			            :action="action"
			            :on-change="uploadonchange"
			            accept=".xlsx,.xls"
			            :show-file-list='false'
			            :auto-upload="false"
			            >
			            <el-button slot="trigger" size="small">导入模板</el-button>
			        </el-upload>
			        <router-link :to="{path:'/managematerialsManagement/added',query: {type: '配方颗粒(浸膏粉)',sid:activeName1}}"><el-button type="primary" v-if="added" style="float:right; margin-right: 10px">新建物料</el-button></router-link>
			    </el-row>
			    <el-table
			        :data="tableData"
			        border
			        ref="multipleTable"
			        header-cell-class-name="table-header"
			    >
              <!-- <el-table-column prop="fromFactoryName" sortable label="厂区标识"></el-table-column> -->
			        <el-table-column prop="breedName" sortable label="名称"></el-table-column>
			        <el-table-column prop="materialType" sortable label="物料类型"></el-table-column>
			        <el-table-column prop="materialCode" sortable label="物料代码"></el-table-column>
			        <el-table-column prop="ypCode" sortable label="药品标识码"></el-table-column>
			        <el-table-column prop="status" sortable label="状态">
			            <template slot-scope="scope">
			                {{scope.row.status == 0?'启用':'禁用'}}
			            </template>
			        </el-table-column>
			        <el-table-column label="操作" width="150" align="center">
			            <template slot-scope="scope">
			                <el-button
			                    type="text"
								v-if="edit"
			                    @click="handleEdit(scope.$index, scope.row)"
			                >编辑</el-button>
			                <el-button
			                    type="text"
			                    @click="handleView(scope.$index, scope.row)"
			                >查看</el-button>
			                <el-button
			                    v-if="scope.row.status == 0"
			                    type="text"
			                    @click="isOk(scope.$index, scope.row)"
			                >禁用</el-button>
			                <el-button
			                    v-if="scope.row.status == 1"
			                    type="text"
			                    @click="isNo(scope.$index, scope.row)"
			                >启用</el-button>
			                <!-- <el-button
			                    type="text"
			                    @click="handleDelete(scope.$index, scope.row)"
			                >删除</el-button> -->
			            </template>
			        </el-table-column>
			    </el-table>
			    <el-pagination layout="total, prev, pager, next, jumper" :page-size="pagesize1" @current-change="handleCurrentChange5" :total="total5" :current-page.sync="currentPage5" style="margin-top:20px"></el-pagination>
			</el-tab-pane>
            <el-tab-pane label="配方颗粒" name="配方颗粒">
                <el-row style="margin:20px 0;">
                    <el-col :span="7">
                        <el-input style="border-radius: 0 5px 5px 0;width:300px;" placeholder="请输入关键词"  v-model.trim="searchName4">
                            <i slot="prefix" class="el-input__icon el-icon-search"></i>
                            <el-button slot="append" @click="handleSearch4">搜索</el-button>
                        </el-input>
                    </el-col>
                    <el-button style="float:right; margin-right: 10px" @click="download">模板下载</el-button>
                    <el-upload
                        class="upload-daoru"
                        ref="upload"
                        :action="action"
                        :on-change="uploadonchange"
                        accept=".xlsx,.xls"
                        :show-file-list='false'
                        :auto-upload="false"
                        >
                        <el-button slot="trigger" size="small">导入模板</el-button>
                    </el-upload>
                    <router-link :to="{path:'/managematerialsManagement/added',query: {type: '配方颗粒',sid:activeName1}}"><el-button type="primary" v-if="added" style="float:right; margin-right: 10px">新建物料</el-button></router-link>
                </el-row>
                <el-table
                    :data="tableData"
                    border
                    ref="multipleTable"
                    header-cell-class-name="table-header"
                >
                    <!-- <el-table-column prop="fromFactoryName" sortable label="厂区标识"></el-table-column> -->
                    <el-table-column prop="breedName" sortable label="名称"></el-table-column>
                    <el-table-column prop="materialType" sortable label="物料类型"></el-table-column>
					          <el-table-column prop="inventoryType" sortable label="产品大类"></el-table-column>
                    <el-table-column prop="materialCode" sortable label="物料代码"></el-table-column>
                    <el-table-column prop="ypCode" sortable label="药品标识码"></el-table-column>
                    <el-table-column prop="prodRecordCode" sortable label="上市备案号"></el-table-column>
                    <el-table-column prop="status" sortable label="状态">
                        <template slot-scope="scope">
                            {{scope.row.status == 0?'启用':'禁用'}}
                        </template>
                    </el-table-column>
                    <el-table-column label="操作" width="150" align="center">
                        <template slot-scope="scope">
                            <el-button
                                type="text"
								                v-if="edit"
                                @click="handleEdit(scope.$index, scope.row)"
                            >编辑</el-button>
                            <el-button
                                type="text"
                                @click="handleView(scope.$index, scope.row)"
                            >查看</el-button>
                            <el-button
                                v-if="scope.row.status == 0"
                                type="text"
                                @click="isOk(scope.$index, scope.row)"
                            >禁用</el-button>
                            <el-button
                                v-if="scope.row.status == 1"
                                type="text"
                                @click="isNo(scope.$index, scope.row)"
                            >启用</el-button>
                            <!-- <el-button
                                type="text"
                                @click="handleDelete(scope.$index, scope.row)"
                            >删除</el-button> -->
                        </template>
                    </el-table-column>
                </el-table>
                <el-pagination layout="total, prev, pager, next, jumper" :page-size="pagesize4" @current-change="handleCurrentChange4" :total="total4" :current-page.sync="currentPage4" style="margin-top:20px"></el-pagination>
            </el-tab-pane>
        </el-tabs>
    </div>
</template>

<script>
import axios from "axios";
import {
  materialBreed_list,
  materialBreed_delete,
  materialBreed_updateStatus,
} from "@/request/api";
import { materials_import } from "@/request/manageapi";
import uploadFile from "../../../common/uploadfile";
export default {
  props: ["activeName1"],
  components: {
    uploadFile,
  },
  data() {
    return {
      activeName: "中药材",
      materialType: "中药材",
      searchName1: "",
      searchName2: "",
      searchName3: "",
      searchName4: "",
      searchName5: "",
      tableData: [],
      total1: 0,
      currentPage1: 1,
      pagesize1: 10,
      total2: 0,
      currentPage2: 1,
      pagesize2: 10,
      total3: 0,
      currentPage3: 1,
      pagesize3: 10,
      total4: 0,
      currentPage4: 1,
      total5: 0,
      currentPage5: 1,
      pagesize4: 10,
      listUrl: "",
      action: "",
      added: true,
      edit: true,
    };
  },
  created() {
    var data = JSON.stringify(this.$store.state.wl);
    var a = "新增";
    var b = "编辑";
    // if(data.indexOf(a) != -1){
    //     this.added = true
    // }else{
    //     this.added = false
    // }
    // if(data.indexOf(b) != -1){
    //     this.edit = true
    // }else{
    //     this.edit = false
    // }
  },
  mounted() {
    console.log(this.$store.state.storName)
    if (this.$store.state.storName == "中药材") {
      this.activeName = "中药材";
      this.init1();
    } else if (this.$store.state.storName == "辅料") {
      this.activeName = "辅料";
      this.init2();
    } else if (this.$store.state.storName == "提取饮片") {
      this.activeName = "提取饮片";
      this.init3();
    } else if (this.$store.state.storName == "配方颗粒") {
      this.activeName = "配方颗粒";
      this.init4();
    } else if (this.$store.state.storName == "配方颗粒(浸膏粉)") {
      this.activeName = "配方颗粒(浸膏粉)";
      this.init5();
    } else {
      this.init1();
    }
  },
  destroyed: function () {
    this.$store.commit("setStorName", "");
  },
  methods: {
    // 调用接口
    init1() {
      materialBreed_list({
        materialType: "中药材",
        searchName: this.searchName1,
        page: this.currentPage1,
        companyId: this.activeName1,
      }).then((res) => {
        this.tableData = res.rows;
        this.total1 = res.total;
      });
    },
    init2() {
      materialBreed_list({
        materialType: "辅料",
        searchName: this.searchName2,
        page: this.currentPage2,
        companyId: this.activeName1,
      }).then((res) => {
        this.tableData = res.rows;
        this.total2 = res.total;
      });
    },
    init3() {
      materialBreed_list({
        materialType: "提取饮片",
        searchName: this.searchName3,
        page: this.currentPage3,
        companyId: this.activeName1,
      }).then((res) => {
        this.tableData = res.rows;
        this.total3 = res.total;
      });
    },
    init4() {
      materialBreed_list({
        materialType: "配方颗粒",
        searchName: this.searchName4,
        page: this.currentPage4,
        companyId: this.activeName1,
      }).then((res) => {
        this.tableData = res.rows;
        this.total4 = res.total;
      });
    },
    init5() {
      materialBreed_list({
        materialType: "配方颗粒(浸膏粉)",
        searchName: this.searchName5,
        page: this.currentPage5,
        companyId: this.activeName1,
      }).then((res) => {
        this.tableData = res.rows;
        this.total5 = res.total;
      });
    },
    // tabs
    handleClick(tab, event) {
      this.currentPage1 = 1;
      this.currentPage2 = 1;
      this.currentPage3 = 1;
      this.currentPage4 = 1;
      this.currentPage5 = 1;
      // this.currentPage6 = 1
      this.materialType = tab.label;
      if (this.materialType == "中药材") {
        this.init1();
      } else if (this.materialType == "辅料") {
        this.init2();
      } else if (this.materialType == "提取饮片") {
        this.init3();
      } else if (this.materialType == "配方颗粒") {
        this.init4();
      } else if (this.materialType == "配方颗粒(浸膏粉)") {
        this.init5();
      }
    },
    // 物料编辑
    handleEdit(index, row) {
      this.$router.push({
        path: "/managematerialsManagement/edit",
        query: {
          id: row.id,
        },
      });
    },
    // 查看物料
    handleView(index, row) {
      this.$router.push({
        path: "/managematerialsManagement/viewed",
        query: {
          id: row.id,
        },
      });
    },
    // 删除物料
    handleDelete(index, row) {
      this.$confirm("此操作将永久删除该条数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        materialBreed_delete(row.id).then((res) => {
          this.tableData.splice(row, 1);
          this.$notify({
            title: "操作成功",
            message: "删除成功",
            type: "success",
          });
        });
      });
    },
    // 模板下载
    download() {
      var data = { companyId: this.activeName1, materialType: this.materialType };
      let url = ""
      if (process.env.NODE_ENV == "development") {
        url = "http://" + window.location.host + "/api/materialBreed/export"
      } else {
        url = "http://" + window.location.host + "/materialBreed/export"
      }
      axios.request({
          url,
          responseType: "blob",
          method: "post",
          data,
        })
        .then((res) => {
          //此处有个坑。这里用content保存文件流，最初是content=res，但下载的test.xls里的内容如下图1，
          //检查了下才发现，后端对文件流做了一层封装，所以将content指向res.data即可
          //另外，流的转储属于浅拷贝，所以此处的content转储仅仅是便于理解，并没有实际作用=_=
          console.log(res.data);
          const content = res.data;
          const blob = new Blob([content]); //构造一个blob对象来处理数据
          const fileName = `物料管理${this.materialType}.xlsx`;

          //对于<a>标签，只有 Firefox 和 Chrome（内核） 支持 download 属性
          //IE10以上支持blob但是依然不支持download
          if ("download" in document.createElement("a")) {
            //支持a标签download的浏览器
            const link = document.createElement("a"); //创建a标签
            link.download = fileName; //a标签添加属性
            link.style.display = "none";
            link.href = URL.createObjectURL(blob);
            document.body.appendChild(link);
            link.click(); //执行下载
            URL.revokeObjectURL(link.href); //释放url
            document.body.removeChild(link); //释放标签
          } else {
            //其他浏览器
            navigator.msSaveBlob(blob, fileName);
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
    // 列表搜索
    handleSearch1() {
      this.currentPage1 = 1;
      this.init1();
    },
    handleSearch2() {
      this.currentPage2 = 1;
      this.init2();
    },
    handleSearch3() {
      this.currentPage3 = 1;
      this.init3();
    },
    handleSearch4() {
      this.currentPage4 = 1;
      this.init4();
    },
    handleSearch5() {
      this.currentPage5 = 1;
      this.init5();
    },
    // 禁用
    isOk(index, row) {
      materialBreed_updateStatus({
        id: row.id,
        status: 1,
      }).then((res) => {
        if (res.code == 200) {
          this.$notify({
            title: "操作成功",
            message: "已禁用",
            type: "success",
          });
          if (row.materialType == "中药材") {
            this.init1();
          } else if (row.materialType == "辅料") {
            this.init2();
          } else if (row.materialType == "提取饮片") {
            this.init3();
          } else if (row.materialType == "配方颗粒") {
            this.init4();
          }
        }
      });
    },
    // 启用
    isNo(index, row) {
      materialBreed_updateStatus({
        id: row.id,
        status: 0,
      }).then((res) => {
        this.$notify({
          title: "操作成功",
          message: "已启用",
          type: "success",
        });
        if (row.materialType == "中药材") {
          this.init1();
        } else if (row.materialType == "辅料") {
          this.init2();
        } else if (row.materialType == "提取饮片") {
          this.init3();
        } else if (row.materialType == "配方颗粒") {
          this.init4();
        }
      });
    },
    // 分页事件
    handleCurrentChange1(val) {
      this.currentPage1 = val;
      this.init1();
    },
    handleCurrentChange2(val) {
      this.currentPage2 = val;
      this.init2();
    },
    handleCurrentChange3(val) {
      this.currentPage3 = val;
      this.init3();
    },
    handleCurrentChange4(val) {
      this.currentPage4 = val;
      this.init4();
    },
    handleCurrentChange5(val) {
      this.currentPage5 = val;
      this.init5();
    },
    uploadonchange(file) {
      const loading = this.$loading({
        lock: true,
        text: "导入中，请勿刷新页面",
        spinner: "el-icon-loading",
        background: "rgba(0, 0, 0, 0.7)",
      });

      let formData = new FormData();
      formData.append("file", file.raw);
      formData.append("companyId", this.activeName1);
      let config = {
        headers: { "Content-Type": "multipart/form-data" },
      };
      materials_import(formData).then((res) => {
        if (res.code == 200) {
          loading.close();
          this.$alert("已导入" + res.data + "条", "导入成功", {
            confirmButtonText: "确定",
            callback: (action) => {},
          });
          if (this.materialType == "中药材") {
            this.init1();
          } else if (this.materialType == "辅料") {
            this.init2();
          } else if (this.materialType == "提取饮片") {
            this.init3();
          } else if (this.materialType == "配方颗粒") {
            this.init4();
          }
          // this.init();
        } else {
          loading.close();
          this.$notify.error({
            title: "操作失败",
            message: "导入失败",
            type: "error",
          });
        }
      });
    },
  },
  watch: {
    activeName1: {
      handler(newVal, oldVal) {
        // console.log(newVal)
        this.currentPage1 = 1;
        this.currentPage2 = 1;
        this.currentPage3 = 1;
        this.currentPage4 = 1;
        this.currentPage5 = 1;
        // this.currentPage6 = 1
        // this.activeName = "中药材";
        this.activeName1 = newVal;
        if (this.$store.state.storName == "中药材") {
          this.activeName = "中药材";
          this.init1();
        } else if (this.$store.state.storName == "辅料") {
          this.activeName = "辅料";
          this.init2();
        } else if (this.$store.state.storName == "提取饮片") {
          this.activeName = "提取饮片";
          this.init3();
        } else if (this.$store.state.storName == "配方颗粒") {
          this.activeName = "配方颗粒";
          this.init4();
        } else if (this.$store.state.storName == "配方颗粒(浸膏粉)") {
          this.activeName = "配方颗粒(浸膏粉)";
          this.init5();
        } else {
          this.init1();
        }
      },
      deep: true,
    },
  },
};
</script>

<style lang="less" scoped>
// 深度作用器
/deep/.upload-daoru {
  .el-upload {
    border: none;
    width: auto;
    height: auto;
    border-radius: 0;
    float: right;
    margin-right: 10px;
  }
}
.el-col {
  margin-bottom: 0;
}
/* .scopClass .el-table{ margin-top: 20px;} */
.el-pagination {
  text-align: center;
}
/*
.el-select .el-input {
width: 130px;
}
.input-with-select .el-input-group__prepend {
background-color: #fff;
}
.el-input--small .el-input__inner{
    border-radius: 5px 0 0 5px !important;
    border-right: none;
} */
</style>
